package com.ityedao.Collection集合遍历的方式;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionTest2 {
    public static void main(String[] args) {
        // Collection集合的遍历的方式二：增强for循环
        Collection<String> c = new ArrayList<>();
        c.add("赵敏");
        c.add("小昭");
        c.add("素素");
        c.add("灭绝");
        for (String ele : c) {
            System.out.println(ele);
        }
        System.out.println("------------------------");
        String[] str = {"小明", "小红", "小红", "小黑"};// 增强for也可以遍历数组
        for (String ele : str) {
            System.out.println(ele);
        }
    }
}
